package com.stox.shared.core.model.enumeration;

import com.stox.shared.core.model.Bar;

public enum BarValue {

	OPEN, HIGH, MID, LOW, CLOSE, VOLUME, RANGE;

	public double get(final Bar bar) {
		switch (this) {
			case OPEN:
				return bar.getOpen();
			case HIGH:
				return bar.getHigh();
			case MID:
				return bar.getMid();
			case LOW:
				return bar.getLow();
			case CLOSE:
				return bar.getClose();
			case VOLUME:
				return bar.getVolume();
			case RANGE:
				return bar.getHigh() - bar.getLow();
		}
		return 0;
	}

}
